const Router = require('koa-router')
const { verifyAuth } = require('../middleware/auth.middleware')
const { submitOrder, payOrder, queryPayResult } = require('../controller/payment.controller')
const { updateOrderState, deleteCart, payResultHandle } = require('../middleware/payment.middleware')
const paymentRouter = new Router({ prefix: '/payment' })

paymentRouter.post('/submitOrder', verifyAuth, submitOrder)
paymentRouter.post('/payOrder', verifyAuth, updateOrderState, payOrder, deleteCart)
paymentRouter.post('/queryPayResult', verifyAuth, queryPayResult, payResultHandle)
module.exports = paymentRouter